<?php


namespace app\api\controller\v1;


use app\api\controller\BaseController;
use app\api\model\BookModel;
use app\api\model\InfoModel;
use app\api\model\PlanModel;
use think\Request;
use app\api\service\Login as LoginService;

class CashController extends BaseController
{

    public function updateBetchBalance($month){
    	LoginService::checkToken();
        return InfoModel::updateBetchBalance($month);
    }

    public function getRate($issue){
    	LoginService::checkToken();
        return InfoModel::getRate($issue);
    }

    public function getPlans(Request $request){
    	LoginService::checkToken();
        $parmas = $request->post();
        $page = $parmas['page'];
        $size = $parmas['size'];
        return PlanModel::getPlans($page, $size);
    }

    public function getInfos($month){
    	LoginService::checkToken();
        return InfoModel::getInfos($month);
    }

    public function getBooks($month){
    	LoginService::checkToken();
        return BookModel::getBooks($month);
    }

    public function getInfoWithBook($month, $cb_id){
    	LoginService::checkToken();
        return InfoModel::getInfoWithBook($month, $cb_id);
    }

    public function saveBook($month, $title){
    	LoginService::checkToken();
        return BookModel::saveBook($month, $title);
    }

    public function updateBookStates(Request  $request){
    	LoginService::checkToken();
        return BookModel::updateBookStates($request);
    }

    public function sortList($month, $category){
    	LoginService::checkToken();
        return InfoModel::sortList($month, $category);
    }

    public function updateLight($id){
    	LoginService::checkToken();
        return InfoModel::updateLight($id);
    }

    public function saveInfo($position, $id){
    	LoginService::checkToken();
        return InfoModel::saveInfo($position, $id);
    }

    public function deleteInfo($id){
    	LoginService::checkToken();
        return InfoModel::deleteInfo($id);
    }

    public function updateData(Request $request){
    	LoginService::checkToken();
        return InfoModel::updateData($request);
    }

    public function updatePlanRemark(Request $request){
    	LoginService::checkToken();
        return PlanModel::updatePlanRemark($request);
    }

    public function updatePlanState($month, $state){
    	LoginService::checkToken();
        return PlanModel::updatePlanState($month, $state);
    }

    public function updateBudgerate($month, $budget_rate){
    	LoginService::checkToken();
        return InfoModel::updateBudgerate($month, $budget_rate);
    }

    public function getSystemJson($month, $sid){
    	LoginService::checkToken();
        return InfoModel::getSystemJson($month, $sid);
    }

    public function deletePlan($month){
    	LoginService::checkToken();
        return InfoModel::deletePlan($month);
    }

    public function copyPlan($month){
    	LoginService::checkToken();
        return InfoModel::copyPlan($month);
    }

    public function generate(){
        return InfoModel::generate();
    }

}